package com.s3.khospitalds.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.s3.khospitalds.entity.Complaints;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.CrossOrigin;

import java.util.Date;

/**
 * @author hlq
 * @version 1.0
 * @Description
 * @date 2025/3/4 14:31
 */
@Mapper
@Repository
public interface ComplaintsMapper extends BaseMapper<Complaints> {
    // 新增投诉信息
    @Insert("INSERT INTO complaints(date,phone,name,content,department,way,processing_status,results) VALUES (#{date},#{phone},#{name},#{content},#{department},#{way},'该投诉在处理中','')")
    public int insert(
            @Param("date") Date date,
            @Param("phone") String phone,
            @Param("name") String name,
            @Param("content") String content,
            @Param("department") String department,
            @Param("way") String way
    );
    // 修改投诉信息
    @Update("UPDATE complaints SET processing_status='该投诉已经处理',results=#{results} WHERE id=#{id}")
    public int updateByReply(@Param("results") String results, @Param("id") Integer id);
}
